package com.power.sifa.approve.model;


import com.plf.core.base.model.Ha_attachment;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
*  送达记录文书材料实体类
*/

@Entity
@ApiModel(value="送达记录文书材料")
@Data
@Table(name="Apl_arrive_material",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
@AllArgsConstructor
//@IdClass(Apl_arrive_material.Apl_arrive_materialPK.class) 用于复合组件
public class Apl_arrive_material extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @ApiModelProperty(value = "送达记录id")
    private String recordid;

    @ApiModelProperty(value = "材料id")
    private String attachid;

    @ApiModelProperty(value = "材料类型")
    private Integer matttype;

    @ApiModelProperty(value = "材料记录id")
    private String materialid;

    @ApiModelProperty(value = "所属阶段")
    private Integer stage;

    /**
     *  材料类型文本
     */
    @Transient
    @FieldEnumText(eum="Tp_procmaterial", valuefield="matttype")
    private String matttype_text;

    /**
     *  所属阶段文本
     */
    @Transient
    @FieldEnumText(eum="Tp_stage", valuefield="stage")
    private String stage_text;

    @Transient
    private Ha_attachment file;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("recordid", this.getRecordid());
        map.put("attachid", this.getAttachid());
        map.put("matttype_text", this.matttype_text);
        map.put("matttype", this.getMatttype());
        map.put("materialid", this.getMaterialid());
        map.put("stage_text", this.stage_text);
        map.put("stage", this.getStage());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_arrive_materialPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Apl_arrive_materialPK pk = (Apl_arrive_materialPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}